// 全局请求封装
export default(path, params = {}, loading = true, method = "POST") => {
	if (loading) uni.showLoading({ title: "加载中", mask: true });
	return new Promise((resolve, reject) => {
		uni.request({
			url: import.meta.env.VITE_APP_BASE_URL + path,
			method,
			data: params,
      timeout: 15000,
			// header:{ Authorization: token },
			header:{
				// 'Content-Type':	'application/json; charset=utf-8'
			},
			success(res) {
				uni.hideLoading();
				const { statusCode, data } = res
				if (statusCode === 200) {
					if (data.status == 200) {
            resolve(data.data);
					} else {
						reject(data)
					}
				} else {
					reject(res)
				}
			},
			fail(err) {
				uni.hideLoading();
				reject(err);
			}
		});
	});
};